package com.cyt.chattlibrary.message.model;

import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author QiQi
 * @ClassName: UserInfo
 * @date 2018/10/20
 * @description
 */
public class UserInfo implements Parcelable {
    private String id;
    private String name;
    private Uri portraitUri;

    public String getId() {
        return id == null ? "" : id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name == null ? "" : name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Uri getPortraitUri() {
        return portraitUri;
    }

    public void setPortraitUri(Uri portraitUri) {
        this.portraitUri = portraitUri;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.name);
        dest.writeParcelable(this.portraitUri, flags);
    }

    public UserInfo(String id, String name, Uri portraitUri) {
        this.id = id;
        this.name = name;
        this.portraitUri = portraitUri;
    }

    public UserInfo(Parcel in) {
        this.id = in.readString();
        this.name = in.readString();
        this.portraitUri = in.readParcelable(Uri.class.getClassLoader());
    }

    public static final Parcelable.Creator<UserInfo> CREATOR = new Parcelable.Creator<UserInfo>() {
        @Override
        public UserInfo createFromParcel(Parcel source) {
            return new UserInfo(source);
        }

        @Override
        public UserInfo[] newArray(int size) {
            return new UserInfo[size];
        }
    };
}
